<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div>
        用函数实现内置方法some 
    </div>
    <script>
        function mySome ( arr , fn ) {
            for ( var i = 0 ; arr.length ; i ++ ) {
                if ( fn( arr[i] , i , arr ) ) {
                    return true ; 
                } 
                if ( i == arr.length - 1 ) {
                    if ( fn( arr[i] , i , arr ) ) {
                        return true ; 
                    } else {
                        return false;
                    }
                }
            }
        }
        var arr = [ true , false ,  false , false , false , false , false , false ] ;
        var res = mySome( arr , function ( item , key , arr ){
            if ( item ) {
                return true ; 
            } else {
                return false ;
            }
        });
        console.log(res);
    </script>
</body>
</html>